﻿@model EdexApiClient.Invoices

<div class="modal" data-name="INVOICES">

    <div class="modal-header">
        <table style="width:100%">
            <tr>
                <td><h3>Редактирование документа</h3></td>
                <td style="text-align:right"><a href="#" class="btn" data-dismiss="modal">Закрыть</a></td>
            </tr>
        </table>
    </div>

    <div class="modal-body">
        <form name="INVOICES" class="form-horizontal" method="post"> 
            <fieldset> 
                <table>
                    <tr>
                        <td>
                            <div class="control-group"> 
                                <label class="control-label" for="COMPANY_NAME">Компания отправитель</label>
                                <div class="controls">
                                    <input type="text" class="input-large" name="COMPANY_NAME" value="@Model.COMPANY.COMPANY_NAME" readonly="readonly">
                                </div> 
                            </div> 
                        </td>

                        <td>
                            <div class="control-group"> 
                                <label class="control-label" for="DOC_NUMBER">№, Дата</label>
                                <div class="controls">
                                    <input type="text" class="input-small" name="DOC_NUMBER" value="@Model.DOC_NUMBER" readonly="readonly">

                                    <div id="dt1" class="input-append date" data-date="" data-date-format="dd.mm.yyyy">
                                        <input type="text" class="input-small" name="DOC_DATE" value="@Model.DOC_DATE.ToShortDateString()" readonly="readonly">
                                        <span class="add-on"><i class="icon-th"></i></span>
                                    </div>
                                </div> 
                            </div> 

                        </td>
                    </tr>

                    <tr>
                        <td>
                            <div class="control-group"> 
                                <label class="control-label" for="LOCATION_NAME">Склад</label>
                                <div class="controls">
                                    <input type="text" class="input-medium" name="LOCATION_NAME" value="@(Model.LOCATION != null ? Model.LOCATION.LOCATION_NAME : String.Empty)" readonly="readonly">
                                    <a href="#" class="btn" data-index="@Model.GUID_RECORD" data-action="EDIT-LOCATION-MAPPING"><i class="icon-edit"></i></a>
                                </div> 
                            </div> 
                        </td>
                        <td>
                            <div class="control-group"> 
                                <label class="control-label" for="TOTAL_AMOUNT">Cумма, Налог</label>
                                <div class="controls">
                                    <input type="text" class="input-small" readonly="readonly" name="TOTAL_AMOUNT" value="@Model.TOTAL_AMOUNT">
                                    <input type="text" class="input-small" readonly="readonly" name="TAX_AMOUNT" value="@Model.TAX_AMOUNT">
                                </div>
                            </div> 
                            
                        </td>
                    </tr>

                    <tr>
                        <td colspan="2">
                            <div class="control-group"> 
                                <label class="control-label" for="NOTE">Примечание</label>
                                <div class="controls">
                                    <textarea class="span7" name="NOTE" readonly="readonly">@Model.NOTE</textarea>
                                </div>
                            </div> 
                        </td>
                    </tr>
                </table>                
                                
            </fieldset>
        </form>

        <table data-name="INVOICE_LINES" class="table table-striped">
            <thead>
                <tr>
                    <th>Товар</th>
                    <th>Код товара</th>
                    <th>Количество</th>
                    <th>Цена</th>
                    <th>Сумма</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var record in Model.LINES) {
                <tr data-index="@record.GUID_RECORD">
                    <td>@(record.ITEM != null ? record.ITEM.ITEM_NAME : String.Empty)</td>
                    <td>@(record.ITEM != null ? record.ITEM.EXT_KEY : String.Empty)</td>
                    <td>@record.QUANTITY</td>
                    <td>@record.PRICE</td>
                    <td>@record.TOTAL</td>
                </tr>
                }
            </tbody>
        </table>

    </div>

    <div class="modal-footer">
    </div>
</div>
